from django.db import models

# Create your models here.

class Usermodel(models.Model):
    email = models.EmailField(unique=True,verbose_name="邮箱")
    name = models.CharField(max_length=100,verbose_name="用户名")
    user_head = models.FileField(upload_to='user_head/',null=True,blank=True,default='user_head/default.png',verbose_name="用户头像")
    pw = models.CharField(max_length=100,verbose_name="密码")
    age = models.IntegerField(null=True,verbose_name="年龄")
    GEND_CHOICES = ((1, '男'),(2, '女'),(0, '未知'))
    gender = models.IntegerField(choices=GEND_CHOICES,default=0,verbose_name="性别")
    phone_num = models.CharField(null=True,max_length=11,verbose_name="手机号")
    address = models.CharField(null=True,max_length=100,verbose_name="地址")
    create_time = models.DateTimeField(null=True,auto_now_add=True,verbose_name="创建时间")

    def __str__(self):
        return self.email

    class Meta:
        db_table = "users"
        verbose_name = "用户"
        verbose_name_plural = verbose_name